//
//  MoreViewController.m
//  NBAApp
//
//  Created by 刘意明 on 16/11/30.
//  Copyright © 2016年 Manito. All rights reserved.
//

#import "MoreViewController.h"
#import "MyViewController.h"//我的
#import "MoreView.h"
@interface MoreViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    MoreView *Mya;
    NSArray *Myarr;//内容
    NSArray *MyImage;
    NSArray *Saiarr;//赛事互动
//    NSArray *saiImage;
//    NSArray *Gouarr;//购买
//    NSArray *GouImage;
}
@end

@implementation MoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor colorWithRed:246.0/255 green:246.0/255 blue:246.0/255 alpha:1];
    self.navigationItem.title=@"更多";
    UIBarButtonItem *right =[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"人物.png"] style:UIBarButtonItemStylePlain target:self action:@selector(ClickMy:)];
    self.navigationItem.rightBarButtonItem=right;
    UIBarButtonItem *left =[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"篮球.png"] style:UIBarButtonItemStylePlain target:self action:@selector(Click:)];
    self.navigationItem.leftBarButtonItem=left;
    
    //
    [self addImage];
    
    Mya =[[MoreView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
    Mya.Mytable.delegate = self;
    Mya.Mytable.dataSource = self;
    self.view = Mya;
    
}
//添加内容
-(void)addImage
{
    Myarr =[NSArray arrayWithObjects:@"球队",@"队员",@"球队赛程",@"排名",@"图集",@"重要日期", nil];
    MyImage =[NSArray arrayWithObjects:@"球队管理3",@"运动3",@"日程3",@"排名3",@"图集3",@"日历3", nil];
    Saiarr =[NSArray arrayWithObjects:@"内容",@"赛事互动",@"购买", nil];
    
}
//点击右上角跳转到我的
- (void)ClickMy:(UIBarButtonItem *)btn {
    MyViewController *mm =[[MyViewController alloc] init];
    mm.hidesBottomBarWhenPushed = YES;//隐藏tabbar
    [self.navigationController pushViewController:mm animated:YES];
    mm.hidesBottomBarWhenPushed = NO;
}
//点击右上角跳转到篮球
- (void)Click:(UIBarButtonItem *)btn {
    
}

#pragma mark --tableview数据源的代理方法
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 3;
}
//行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 0 ) {
        return 6;
    }
    return 1;
}
//内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellID =@"cell";
    UITableViewCell *cell =[Mya.Mytable dequeueReusableCellWithIdentifier:CellID];
    if (cell == nil) {
        cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
    }
    if (indexPath.section==0) {
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        cell.textLabel.text=Myarr[indexPath.row];
        cell.imageView.image=[UIImage imageNamed:MyImage[indexPath.row]];
    }
    if (indexPath.section==1) {
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        cell.imageView.image=[UIImage imageNamed:@"购买.png"];
    }
    if (indexPath.section==2) {
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        cell.imageView.image=[UIImage imageNamed:@"赛事互动.png"];
    }
    return cell;
}
//距离顶部距离
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        return 35;
    }
    return 15;
}
//单元格高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}
//表头文字
- (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    return Saiarr[section];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
